#include "qclickwidget.h"

QClickWidget::QClickWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::widgetg)
{
    connect(this, SIGNAL(clicked()), this, SLOT(mouseClicked()));

}
void QClickWidget::mouseClicked()
{
    //处理代码
    cout<<"成功"<<endl;
}

void QClickWidget::mousePressEvent(QMouseEvent *ev)
{
    mouserPos = QPoint(ev->x(), ev->y());
}

void QClickWidget::mouseReleaseEvent(QMouseEvent *ev)
{
    if(mousePos == QPoint(ev->x(), ev->y())) emit clicked();
}
